package com.gy.spark.core.transformations

import org.apache.spark.{SparkConf, SparkContext}

object Operator_reduceByKey {


  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
    conf.setMaster("local").setAppName(this.getClass.getSimpleName)
    val sc = new SparkContext(conf)
    val rdd1 = sc.textFile("spark/input/words.txt")

    rdd1.flatMap(_.split(" ")).map((_, 1)).reduceByKey(_ + _).foreach(println)

  }

}
